package src.edu.wayne.cs.csc4110.hw6.plugins;

import java.util.ArrayList;
import java.util.HashSet;

import src.edu.wayne.cs.csc4110.hw6.implementations.FrameWorkImpl;
import src.edu.wayne.cs.csc4110.hw6.implementations.stateMachine.StateMachine;
import src.edu.wayne.cs.csc4110.hw6.interfaces.FrameWork;
import src.edu.wayne.cs.csc4110.hw6.interfaces.Game;
import src.edu.wayne.cs.csc4110.hw6.interfaces.PluginToFrameWorkInterface;
import src.edu.wayne.cs.csc4110.hw6.interfaces.User;
import src.edu.wayne.cs.csc4110.hw6.tests.DatabaseTests;


@SuppressWarnings("unused")
public class Main {
	public static void main(String[] args) throws Exception {
		
		//This code makes a dbase using the JUnit test code.
		DatabaseTests dbaseFactory = new DatabaseTests();
		dbaseFactory.setUp(); 
		
		//This code should stay in the final version.
		FrameWork myFramework = FrameWorkImpl.getFrameWork();
		myFramework.setDataBase(dbaseFactory.getDataBase());
		
		


		//This code loads up a couple of sample plugins.
		PluginToFrameWorkInterface gameInterface = (FrameWorkImpl) myFramework;
		ArrayList<Game> games = new ArrayList<Game>();
		ExamplePluginOne gameOne = new ExamplePluginOne(gameInterface);
		gameOne.setGameName("Game One");
		games.add(gameOne);
		
		ExamplePluginTwo gameTwo = new ExamplePluginTwo(gameInterface);
		gameTwo.setGameName("Game Two");
		games.add(gameTwo);
		((FrameWorkImpl) myFramework).setGameList(games);
		
//		
//		HashSet<User> usersInSession = new HashSet<User>();
//		
//		//The code loads three users.
//		usersInSession.add(myFramework.getDataBase().getUser("cr3550@wayne.edu"));
//		usersInSession.add(myFramework.getDataBase().getUser("user2@wayne.edu"));
//		usersInSession.add(myFramework.getDataBase().getUser("user1@wayne.edu"));
//		
//		
//		myFramework.setUsersInSession(usersInSession);		
//		
//		//This code sets the current user to user1.
//		( (FrameWorkImpl) myFramework).setCurrentUser(myFramework.getDataBase().getUser("user1@wayne.edu"));
//		
//		//This code moves the stateMachine to the LoggedInState, and brings up the UserHomePanel.
//		StateMachine stateMachine = ( (FrameWorkImpl) myFramework).getStateMachine();
//		stateMachine.setCurrentUser(myFramework.getDataBase().getUser("user1@wayne.edu"));
//		stateMachine.setState(stateMachine.getLoggedInState());
//		
		myFramework.startFrameWork();
		
		System.out.printf("all done \n");
	}
}
